
import communication.HostCommunication;
import cont.UIController;
import javafx.application.Application;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;


public class Main extends Application
{

	/**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Application.launch(Main.class, (java.lang.String[])null);
        //HostCommunication.get().getClips();
    }

    @Override
    public void start(Stage primaryStage) {
        try {
            AnchorPane page = (AnchorPane) FXMLLoader.load(Main.class.getResource("layout.fxml"));
            Scene scene = new Scene(page);
            primaryStage.setScene(scene);
            primaryStage.setTitle("FXML is Simple");
            primaryStage.show();
            scene.setOnKeyPressed(new EventHandler<KeyEvent>(){

                @Override
                public void handle(KeyEvent event) {
                    System.out.println("DEL");
                    if(event.getCode().equals(KeyCode.DELETE)){
                            try {   
                                UIController.getCurrentDrawable().onDelete();
                                UIController.setCurrentDrawable(null);
                            } catch (Exception e) {
                            }
                            
                        } 
                }
            });
            Canvas c = new Canvas();
            
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

}
